<?php
	//error_reporting (e_all ^ e_notice); //suppress some unnecessary messages
	$filter="($searchfield=$searchfor*)"; //wildcard is * remove it if you want an exact match
	$sr=ldap_search($cnx, $dn, $filter, $ldapfieldstofind);
	$info = ldap_get_entries($cnx, $sr);
	//array list
	$tpl->assign("LDAP_c",$info[0]['c'][0]);
	$tpl->assign("LDAP_cn",$info[0]['cn'][0]);
	$tpl->assign("LDAP_co",$info[0]['co'][0]);
	$tpl->assign("LDAP_company",$info[0]['company'][0]);
	$tpl->assign("LDAP_countrycode",$info[0]['countrycode'][0]);
	$tpl->assign("LDAP_department",$info[0]['department'][0]);
	$tpl->assign("LDAP_displayname",$info[0]['displayname'][0]);
	$tpl->assign("LDAP_givenname",$info[0]['givenname'][0]);
	$tpl->assign("LDAP_homedirectory",$info[0]['homedirectory'][0]);
	$tpl->assign("LDAP_homephone",$info[0]['homephone'][0]);
	$tpl->assign("LDAP_mail",$info[0]['mail'][0]);
	$tpl->assign("LDAP_mobile",$info[0]['mobile'][0]);
	$tpl->assign("LDAP_name",$info[0]['name'][0]);
	$tpl->assign("LDAP_physicaldeliveryofficename",$info[0]['physicaldeliveryofficename'][0]);
	$tpl->assign("LDAP_samaccountname",$info[0]['samaccountname'][0]);
	$tpl->assign("LDAP_sn",$info[0]['sn'][0]);
	$tpl->assign("LDAP_st",$info[0]['st'][0]);
	$tpl->assign("LDAP_street",$info[0]['street'][0]);
	$tpl->assign("LDAP_streetaddress",$info[0]['streetaddress'][0]);
	$tpl->assign("LDAP_telephonenumber",$info[0]['telephonenumber'][0]);
	$tpl->assign("LDAP_teletexterminalidentifier",$info[0]['teletexterminalidentifier'][0]);
	$tpl->assign("LDAP_telexnumber",$info[0]['telexnumber'][0]);
	$tpl->assign("LDAP_personaltitle",$info[0]['personaltitle'][0]);
	$tpl->assign("LDAP_postaladdress",$info[0]['postaladdress'][0]);
	$tpl->assign("LDAP_postalcode",$info[0]['postalcode'][0]);
	$tpl->assign("LDAP_postofficebox",$info[0]['postofficebox'][0]);
	$tpl->assign("LDAP_preferreddeliverymethod",$info[0]['preferreddeliverymethod'][0]);
	$tpl->assign("LDAP_preferredou",$info[0]['preferredou'][0]);
	$tpl->assign("LDAP_primaryinternationalisdnnumber",$info[0]['primaryinternationalisdnnumber'][0]);
	$tpl->assign("LDAP_primarytelexnumber",$info[0]['primarytelexnumber'][0]);
	$tpl->assign("LDAP_thumbnaillogo",$info[0]['thumbnaillogo'][0]);
	$tpl->assign("LDAP_thumbnailphoto",$info[0]['thumbnailphoto'][0]);
	$tpl->assign("LDAP_title",$info[0]['title'][0]);
	$tpl->assign("LDAP_userprincipalname",$info[0]['userprincipalname'][0]);
	$tpl->assign("LDAP_wwwhomepage",$info[0]['wwwhomepage'][0]);
	$tpl->assign("LDAP_accountexpires",$info[0]['accountexpires'][0]);
	$tpl->assign("LDAP_accountnamehistory",$info[0]['accountnamehistory'][0]);
	$tpl->assign("LDAP_acspolicyname",$info[0]['acspolicyname'][0]);
	$tpl->assign("LDAP_admincount",$info[0]['admincount'][0]);
	$tpl->assign("LDAP_admindescription",$info[0]['admindescription'][0]);
	$tpl->assign("LDAP_admindisplayname",$info[0]['admindisplayname'][0]);
	$tpl->assign("LDAP_allowedattributes",$info[0]['allowedattributes'][0]);
	$tpl->assign("LDAP_allowedattributeseffective",$info[0]['allowedattributeseffective'][0]);
	$tpl->assign("LDAP_allowedchildclasses",$info[0]['allowedchildclasses'][0]);
	$tpl->assign("LDAP_allowedchildclasseseffective",$info[0]['allowedchildclasseseffective'][0]);
	$tpl->assign("LDAP_altsecurityidentities",$info[0]['altsecurityidentities'][0]);
	$tpl->assign("LDAP_assistant",$info[0]['assistant'][0]);
	$tpl->assign("LDAP_badpasswordtime",$info[0]['badpasswordtime'][0]);
	$tpl->assign("LDAP_badpwdcount",$info[0]['badpwdcount'][0]);
	$tpl->assign("LDAP_bridgeheadserverlistbl",$info[0]['bridgeheadserverlistbl'][0]);
	$tpl->assign("LDAP_canonicalname",$info[0]['canonicalname'][0]);
	$tpl->assign("LDAP_codepage",$info[0]['codepage'][0]);
	$tpl->assign("LDAP_comment",$info[0]['comment'][0]);
	$tpl->assign("LDAP_controlaccessrights",$info[0]['controlaccessrights'][0]);
	$tpl->assign("LDAP_createtimestamp",$info[0]['createtimestamp'][0]);
	$tpl->assign("LDAP_dbcspwd",$info[0]['dbcspwd'][0]);
	$tpl->assign("LDAP_defaultclassstore",$info[0]['defaultclassstore'][0]);
	$tpl->assign("LDAP_description",$info[0]['description'][0]);
	$tpl->assign("LDAP_desktopprofile",$info[0]['desktopprofile'][0]);
	$tpl->assign("LDAP_destinationindicator",$info[0]['destinationindicator'][0]);
	$tpl->assign("LDAP_directreports",$info[0]['directreports'][0]);
	$tpl->assign("LDAP_displaynameprintable",$info[0]['displaynameprintable'][0]);
	$tpl->assign("LDAP_distinguishedname",$info[0]['distinguishedname'][0]);
	$tpl->assign("LDAP_division",$info[0]['division'][0]);
	$tpl->assign("LDAP_dsasignature",$info[0]['dsasignature'][0]);
	$tpl->assign("LDAP_dscorepropagationdata",$info[0]['dscorepropagationdata'][0]);
	$tpl->assign("LDAP_dynamicldapserver",$info[0]['dynamicldapserver'][0]);
	$tpl->assign("LDAP_employeeid",$info[0]['employeeid'][0]);
	$tpl->assign("LDAP_extensionname",$info[0]['extensionname'][0]);
	$tpl->assign("LDAP_facsimiletelephonenumber",$info[0]['facsimiletelephonenumber'][0]);
	$tpl->assign("LDAP_flags",$info[0]['flags'][0]);
	$tpl->assign("LDAP_fromentry",$info[0]['fromentry'][0]);
	$tpl->assign("LDAP_frscomputerreferencebl",$info[0]['frscomputerreferencebl'][0]);
	$tpl->assign("LDAP_frsmemberreferencebl",$info[0]['frsmemberreferencebl'][0]);
	$tpl->assign("LDAP_fsmoroleowner",$info[0]['fsmoroleowner'][0]);
	$tpl->assign("LDAP_garbagecollperiod",$info[0]['garbagecollperiod'][0]);
	$tpl->assign("LDAP_generationqualifier",$info[0]['generationqualifier'][0]);
	$tpl->assign("LDAP_groupmembershipsam",$info[0]['groupmembershipsam'][0]);
	$tpl->assign("LDAP_grouppriority",$info[0]['grouppriority'][0]);
	$tpl->assign("LDAP_groupstoignore",$info[0]['groupstoignore'][0]);
	$tpl->assign("LDAP_homedrive",$info[0]['homedrive'][0]);
	$tpl->assign("LDAP_homepostaladdress",$info[0]['homepostaladdress'][0]);
	$tpl->assign("LDAP_info",$info[0]['info'][0]);
	$tpl->assign("LDAP_initials",$info[0]['initials'][0]);
	$tpl->assign("LDAP_instancetype",$info[0]['instancetype'][0]);
	$tpl->assign("LDAP_internationalisdnnumber",$info[0]['internationalisdnnumber'][0]);
	$tpl->assign("LDAP_ipphone",$info[0]['ipphone'][0]);
	$tpl->assign("LDAP_iscriticalsystemobject",$info[0]['iscriticalsystemobject'][0]);
	$tpl->assign("LDAP_isdeleted",$info[0]['isdeleted'][0]);
	$tpl->assign("LDAP_isprivilegeholder",$info[0]['isprivilegeholder'][0]);
	$tpl->assign("LDAP_l",$info[0]['l'][0]);
	$tpl->assign("LDAP_lastknownparent",$info[0]['lastknownparent'][0]);
	$tpl->assign("LDAP_lastlogoff",$info[0]['lastlogoff'][0]);
	$tpl->assign("LDAP_lastlogon",$info[0]['lastlogon'][0]);
	$tpl->assign("LDAP_legacyexchangedn",$info[0]['legacyexchangedn'][0]);
	$tpl->assign("LDAP_lmpwdhistory",$info[0]['lmpwdhistory'][0]);
	$tpl->assign("LDAP_localeid",$info[0]['localeid'][0]);
	$tpl->assign("LDAP_lockouttime",$info[0]['lockouttime'][0]);
	$tpl->assign("LDAP_logoncount",$info[0]['logoncount'][0]);
	$tpl->assign("LDAP_logonhours",$info[0]['logonhours'][0]);
	$tpl->assign("LDAP_logonworkstation",$info[0]['logonworkstation'][0]);
	$tpl->assign("LDAP_managedobjects",$info[0]['managedobjects'][0]);
	$tpl->assign("LDAP_manager",$info[0]['manager'][0]);
	$tpl->assign("LDAP_masteredby",$info[0]['masteredby'][0]);
	$tpl->assign("LDAP_maxstorage",$info[0]['maxstorage'][0]);
	$tpl->assign("LDAP_memberof",$info[0]['memberof'][0]);
	$tpl->assign("LDAP_mhsoraddress",$info[0]['mhsoraddress'][0]);
	$tpl->assign("LDAP_middlename",$info[0]['middlename'][0]);
	$tpl->assign("LDAP_modifytimestamp",$info[0]['modifytimestamp'][0]);
	$tpl->assign("LDAP_ms-ds-consistencychildcount",$info[0]['ms-ds-consistencychildcount'][0]);
	$tpl->assign("LDAP_ms-ds-consistencyguid",$info[0]['ms-ds-consistencyguid'][0]);
	$tpl->assign("LDAP_ms-ds-creatorsid",$info[0]['ms-ds-creatorsid'][0]);
	$tpl->assign("LDAP_msmqdigests",$info[0]['msmqdigests'][0]);
	$tpl->assign("LDAP_msmqdigestsmig",$info[0]['msmqdigestsmig'][0]);
	$tpl->assign("LDAP_msmqsigncertificates",$info[0]['msmqsigncertificates'][0]);
	$tpl->assign("LDAP_msmqsigncertificatesmig",$info[0]['msmqsigncertificatesmig'][0]);
	$tpl->assign("LDAP_msnpallowdialin",$info[0]['msnpallowdialin'][0]);
	$tpl->assign("LDAP_msnpcallingstationid",$info[0]['msnpcallingstationid'][0]);
	$tpl->assign("LDAP_msnpsavedcallingstationid",$info[0]['msnpsavedcallingstationid'][0]);
	$tpl->assign("LDAP_msradiuscallbacknumber",$info[0]['msradiuscallbacknumber'][0]);
	$tpl->assign("LDAP_msradiusframedipaddress",$info[0]['msradiusframedipaddress'][0]);
	$tpl->assign("LDAP_msradiusframedroute",$info[0]['msradiusframedroute'][0]);
	$tpl->assign("LDAP_msradiusservicetype",$info[0]['msradiusservicetype'][0]);
	$tpl->assign("LDAP_msrassavedcallbacknumber",$info[0]['msrassavedcallbacknumber'][0]);
	$tpl->assign("LDAP_msrassavedframedipaddress",$info[0]['msrassavedframedipaddress'][0]);
	$tpl->assign("LDAP_msrassavedframedroute",$info[0]['msrassavedframedroute'][0]);
	$tpl->assign("LDAP_netbootscpbl",$info[0]['netbootscpbl'][0]);
	$tpl->assign("LDAP_networkaddress",$info[0]['networkaddress'][0]);
	$tpl->assign("LDAP_nonsecuritymemberbl",$info[0]['nonsecuritymemberbl'][0]);
	$tpl->assign("LDAP_ntpwdhistory",$info[0]['ntpwdhistory'][0]);
	$tpl->assign("LDAP_ntsecuritydescriptor",$info[0]['ntsecuritydescriptor'][0]);
	$tpl->assign("LDAP_o",$info[0]['o'][0]);
	$tpl->assign("LDAP_objectcategory",$info[0]['objectcategory'][0]);
	$tpl->assign("LDAP_objectclass",$info[0]['objectclass'][0]);
	$tpl->assign("LDAP_objectguid",$info[0]['objectguid'][0]);
	$tpl->assign("LDAP_objectsid",$info[0]['objectsid'][0]);
	$tpl->assign("LDAP_objectversion",$info[0]['objectversion'][0]);
	$tpl->assign("LDAP_operatorcount",$info[0]['operatorcount'][0]);
	$tpl->assign("LDAP_otherfacsimiletelephonenumber",$info[0]['otherfacsimiletelephonenumber'][0]);
	$tpl->assign("LDAP_otherhomephone",$info[0]['otherhomephone'][0]);
	$tpl->assign("LDAP_otheripphone",$info[0]['otheripphone'][0]);
	$tpl->assign("LDAP_otherloginworkstations",$info[0]['otherloginworkstations'][0]);
	$tpl->assign("LDAP_othermailbox",$info[0]['othermailbox'][0]);
	$tpl->assign("LDAP_othermobile",$info[0]['othermobile'][0]);
	$tpl->assign("LDAP_otherpager",$info[0]['otherpager'][0]);
	$tpl->assign("LDAP_othertelephone",$info[0]['othertelephone'][0]);
	$tpl->assign("LDAP_otherwellknownobjects",$info[0]['otherwellknownobjects'][0]);
	$tpl->assign("LDAP_ou",$info[0]['ou'][0]);
	$tpl->assign("LDAP_pager",$info[0]['pager'][0]);
	$tpl->assign("LDAP_partialattributedeletionlist",$info[0]['partialattributedeletionlist'][0]);
	$tpl->assign("LDAP_partialattributeset",$info[0]['partialattributeset'][0]);
	$tpl->assign("LDAP_possibleinferiors",$info[0]['possibleinferiors'][0]);
	$tpl->assign("LDAP_primarygroupid",$info[0]['primarygroupid'][0]);
	$tpl->assign("LDAP_profilepath",$info[0]['profilepath'][0]);
	$tpl->assign("LDAP_proxiedobjectname",$info[0]['proxiedobjectname'][0]);
	$tpl->assign("LDAP_proxyaddresses",$info[0]['proxyaddresses'][0]);
	$tpl->assign("LDAP_pwdlastset",$info[0]['pwdlastset'][0]);
	$tpl->assign("LDAP_querypolicybl",$info[0]['querypolicybl'][0]);
	$tpl->assign("LDAP_registeredaddress",$info[0]['registeredaddress'][0]);
	$tpl->assign("LDAP_replpropertymetadata",$info[0]['replpropertymetadata'][0]);
	$tpl->assign("LDAP_repluptodatevector",$info[0]['repluptodatevector'][0]);
	$tpl->assign("LDAP_repsfrom",$info[0]['repsfrom'][0]);
	$tpl->assign("LDAP_repsto",$info[0]['repsto'][0]);
	$tpl->assign("LDAP_revision",$info[0]['revision'][0]);
	$tpl->assign("LDAP_rid",$info[0]['rid'][0]);
	$tpl->assign("LDAP_samaccounttype",$info[0]['samaccounttype'][0]);
	$tpl->assign("LDAP_scriptpath",$info[0]['scriptpath'][0]);
	$tpl->assign("LDAP_sdrightseffective",$info[0]['sdrightseffective'][0]);
	$tpl->assign("LDAP_securityidentifier",$info[0]['securityidentifier'][0]);
	$tpl->assign("LDAP_seealso",$info[0]['seealso'][0]);
	$tpl->assign("LDAP_serverreferencebl",$info[0]['serverreferencebl'][0]);
	$tpl->assign("LDAP_serviceprincipalname",$info[0]['serviceprincipalname'][0]);
	$tpl->assign("LDAP_showinaddressbook",$info[0]['showinaddressbook'][0]);
	$tpl->assign("LDAP_showinadvancedviewonly",$info[0]['showinadvancedviewonly'][0]);
	$tpl->assign("LDAP_sidhistory",$info[0]['sidhistory'][0]);
	$tpl->assign("LDAP_siteobjectbl",$info[0]['siteobjectbl'][0]);
	$tpl->assign("LDAP_subrefs",$info[0]['subrefs'][0]);
	$tpl->assign("LDAP_subschemasubentry",$info[0]['subschemasubentry'][0]);
//	$tpl->assign("LDAP_supplementalcredentials",$info[0]['supplementalcredentials'][0]);
//	$tpl->assign("LDAP_systemflags",$info[0]['systemflags'][0]);
//	$tpl->assign("LDAP_terminalserver",$info[0]['terminalserver'][0]);
//	$tpl->assign("LDAP_textencodedoraddress",$info[0]['textencodedoraddress'][0]);
//	$tpl->assign("LDAP_tokengroups",$info[0]['tokengroups'][0]);
	$tpl->assign("LDAP_tokengroupsglobalanduniversal",$info[0]['tokengroupsglobalanduniversal'][0]);
	$tpl->assign("LDAP_useraccountcontrol",$info[0]['useraccountcontrol'][0]);
	$tpl->assign("LDAP_usnchanged",$info[0]['usnchanged'][0]);
	$tpl->assign("LDAP_usncreated",$info[0]['usncreated'][0]);
	$tpl->assign("LDAP_whenchanged",$info[0]['whenchanged'][0]);
	$tpl->assign("LDAP_whencreated",$info[0]['whencreated'][0]);
//	$tpl->assign("LDAP_tokengroupsnogcacceptable",$info[0]['tokengroupsnogcacceptable'][0]);
//	$tpl->assign("LDAP_unicodepwd",$info[0]['unicodepwd'][0]);
//	$tpl->assign("LDAP_url",$info[0]['url'][0]);
//	$tpl->assign("LDAP_usercert",$info[0]['usercert'][0]);
//	$tpl->assign("LDAP_usercertificate",$info[0]['usercertificate'][0]);
//	$tpl->assign("LDAP_userparameters",$info[0]['userparameters'][0]);
//	$tpl->assign("LDAP_userpassword",$info[0]['userpassword'][0]);
//	$tpl->assign("LDAP_usersharedfolder",$info[0]['usersharedfolder'][0]);
//	$tpl->assign("LDAP_usersharedfolderother",$info[0]['usersharedfolderother'][0]);
//	$tpl->assign("LDAP_usersmimecertificate",$info[0]['usersmimecertificate'][0]);
//	$tpl->assign("LDAP_userworkstations",$info[0]['userworkstations'][0]);
//	$tpl->assign("LDAP_usndsalastobjremoved",$info[0]['usndsalastobjremoved'][0]);
//	$tpl->assign("LDAP_usnintersite",$info[0]['usnintersite'][0]);
//	$tpl->assign("LDAP_usnlastobjrem",$info[0]['usnlastobjrem'][0]);
//	$tpl->assign("LDAP_usnsource",$info[0]['usnsource'][0]);
//	$tpl->assign("LDAP_wbempath",$info[0]['wbempath'][0]);
//	$tpl->assign("LDAP_wellknownobjects",$info[0]['wellknownobjects'][0]);
	//	$tpl->assign("LDAP_x121address",$info[0]['x121address'][0]);
?>